package com.atguigu.spzx.user.controller;

import com.atguigu.spyx.model.common.Result;
import com.atguigu.spyx.model.common.com.atguigu.spyx.model.entity.h5.Region;
import com.atguigu.spzx.user.service.RegionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LT
 * @create 2023-11-21-17:44
 */
@RestController
@RequestMapping("/api/user/region")
public class RegionController {
    @Resource
    RegionService regionService;

    @GetMapping("/findByParentCode/{parentCode}")
    public Result findByParentCode(@PathVariable("parentCode")Integer parentCode){
        List<Region> regionList = regionService.findByParentCode(parentCode);
        return Result.ok().data(regionList);
    }

}
